<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 7/28/17
 * Time: 2:50 PM
 */

namespace common\models\workin;

/**
 * Class CarInvonceVerifyHuirong
 * @package common\models\workin
 *
 * @property CarInvonceVerifyHuirongBack $carInvonceVerifyHuirongBack
 */
class CarInvonceVerifyHuirong extends \common\models\workin_tables\CarInvonceVerifyHuirong
{
    public function rules()
    {
        return [
            [['grant_key', 'api_key', 'pic_type', 'call_back', 'order_report_id', 'pic', 'search_index'], 'required'],
            [['pic_type'], 'integer'],
            [['order_report_id', 'search_index'], 'unique'],
            [['order_report_id'], 'string', 'max' => 30],
            [['search_index'], 'string', 'max' => 50],
            ['pic', 'file', 'skipOnEmpty' => true, 'checkExtensionByMimeType' => false,'extensions' => 'jpg,jpeg,png'],
            [['grant_key', 'api_key', 'business_code', 'pic_net_path', 'call_back', 'order_report_id'], 'string', 'max' => 200],
        ];
    }

    public function attributeLabels()
    {
        return [
            'grant_key' => 'grant_key合作伙伴的标示',
            'api_key' => 'api_key对应服务的唯一标示',
            'business_code' => 'business_code业务落地行编码',
            'pic' => 'pic（BASE64Encoder转换为字符串，图片大小不超过1M）[购车发票图片]',
            'pic_net_path' => 'pic_net_path图片网络地址',
            'pic_type' => 'pic_type图片类型',
            'call_back' => 'call_back贵司提供的回调函数',
            'order_report_id' => 'order_report_id请求方需携带一个本次请求的唯一标识',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCarInvonceVerifyHuirongBack()
    {
        return $this->hasOne(CarInvonceVerifyHuirongBack::className(), ['car_invonce_verify_huirong_id' => 'id']);
    }
}